import type { Module, ActionContext } from 'vuex'
import type { AxiosResponse } from 'axios'
import type { adviceStateType } from './typings'
import { adviceListGet, adviceRemovePost } from '~/api/system/advice'

const work: Module<adviceStateType, adviceStateType> = {
  namespaced: true,
  state: {},
  getters: {},
  mutations: {},
  actions: {
    // 意见反馈-列表
    async AdviceListGet<S, T>(_: ActionContext<S, T>, params: T) {
      return await adviceListGet<T>(params).then((res: AxiosResponse) => res?.data)
    },
    // 删除意见反馈-列表
    async AdviceRemovePost<S, T>(_: ActionContext<S, T>, params: T) {
      return await adviceRemovePost<T>(params).then((res: AxiosResponse) => res?.data)
    }
  }
}

export default work
